//-----------------------------------------------------------------------
// <copyright file="ShippingStatusReport.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
	
using System;
using System.Data;
using System.ComponentModel;
using System.Collections;

namespace MIMS.WRS.Entities
{
	[Serializable]
	public class ShippingStatusReport : ShippingStatusReportBase
	{
		public ShippingStatusReport()
		{
			this.OrderDate = Nulls.NullDate;
			this.PONo_Consolidation = Nulls.NullInteger;
			this.FactoryETD = Nulls.NullDate;
			this.ShippingDate = Nulls.NullDate;
			this.ETA = Nulls.NullDate;
			this.CompletedDate = Nulls.NullDate;
			this.BulkOrderNo  = Nulls.NullInteger;
			this.InvValue = Nulls.NullDecimal;
			this.SInvoiced = Nulls.NullInteger;
			this.SInvoicedPd = Nulls.NullDate;
			this.ShippingLineID = Nulls.NullInteger;
			this.ContainerDeliveried = Nulls.NullDate;
			this.PayDate = Nulls.NullDate;
			this.POInOpera = Nulls.NullDate;
			this.PDepValue = Nulls.NullDecimal;
			this.SalesOrder = Nulls.NullInteger;
			this.SalesInvoiceDate = Nulls.NullDate;
			this.SalesInvoiceValue = Nulls.NullDecimal;
			this.SalesPaymentDue = Nulls.NullDate;
			this.TargetETD = Nulls.NullDate;
			//this.CatalogID = Nulls.NullInteger;
			//this.ConPointID = Nulls.NullInteger;
			this.ResponsibleID = Nulls.NullInteger;
			this.FactoryETDEnteredDate = Nulls.NullDate;
			this.IsNomShip = "No";
			this.EstActBlank = "";
			this.FeederVessel = "";
		}

		public static int CalculateLeadDays(DateTime orderDate, DateTime shippingDate) 
		{
			if (shippingDate != Nulls.NullDate && orderDate != Nulls.NullDate)
				return ((TimeSpan)shippingDate.Subtract(orderDate)).Days;
			else
				return Nulls.NullInteger;
		}

		public static int CalculateDebtorDays(DateTime  sInvoiceDate, DateTime sInvoicePaid) 
		{
			if (sInvoiceDate != Nulls.NullDate && sInvoicePaid != Nulls.NullDate)
				return ((TimeSpan)sInvoicePaid.Subtract(sInvoiceDate)).Days;
			else
				return Nulls.NullInteger;
		}

		public static int CalculateExtraCreditDays(DateTime  sPaymentDue, DateTime sInvoicePaid) 
		{
			if (sPaymentDue != Nulls.NullDate && sInvoicePaid != Nulls.NullDate)
				return ((TimeSpan)sInvoicePaid.Subtract(sPaymentDue)).Days;
			else
				return Nulls.NullInteger;
		}

		public int LeadDays 
		{
			get 
			{
				return CalculateLeadDays(this.OrderDate, this.ShippingDate);
			}
		}

//		private string shippingLineCode;
//		private string shippingLineUrl;
//		private string conPoint;		

//		public string ShippingLineCode 
//		{
//			get {return shippingLineCode;}
//			set {shippingLineCode = value;}
//		}

//		public string ConPoint 
//		{
//			get {return conPoint;}
//			set {conPoint = value;}
//		}

//		public string ShippingLineUrl 
//		{
//			get {return shippingLineUrl;}
//			set {shippingLineUrl = value;}
//		}
	}
}